{[{define "sys/log/log.html"}]}
{[{template "sys/base/mark.html"}]}
<html>
<head>
    <meta charset="utf-8">
    <title>用户管理</title>
    <link rel="stylesheet" href="/pear-admin-layui/component/pear/css/pear.css"/>
</head>
<body class="pear-container">
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <div class="layui-form-item layui-inline">
                    <div class="layui-input-inline">
                        <input type="text" name="username" autocomplete="off" placeholder="username"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="query">
                        <i class="layui-icon layui-icon-search"></i>
                        查询
                    </button>
                    <button type="reset" class="pear-btn pear-btn-md">
                        <i class="layui-icon layui-icon-refresh"></i>
                        重置
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="layui-card">
    <div class="layui-card-body">
        <table id="table" lay-filter="table"></table>
    </div>
</div>

<script type="text/html" id="createBy">
    {{#if (d.createTime) { }}
    {{d.createName}}（{{layui.util.toDateString(d.createTime*1000, 'yyyy-MM-dd HH:mm:ss')}}）
    {{# } }}
</script>

<script type="text/html" id="updateBy">
    {{#if (d.updateTime) { }}
    {{d.updateName}}（{{layui.util.toDateString(d.updateTime*1000, 'yyyy-MM-dd HH:mm:ss')}}）
    {{# } }}
</script>

<script src="/pear-admin-layui/component/layui/layui.js"></script>
<script src="/pear-admin-layui/component/pear/pear.js"></script>
<script>


    layui.use(['table', 'form', 'jquery', 'common', 'loading'], function () {
        let table = layui.table;
        let form = layui.form;
        let $ = layui.jquery;
        let loading = layui.loading;
        let common = layui.common;

        table.render({
            elem: '#table',
            url: '/sys/log/table',
            page: true,
            cols: [[
                {title: 'ID', field: 'id', align: 'center', hide: true},
                {title: 'ipaddr', field: 'ipaddr', align: 'center'},
                {title: 'url', field: 'url', align: 'center'},
                {title: 'method', field: 'method', align: 'center'},
                {title: 'param', field: 'param', align: 'center'},
                {title: 'result', field: 'result', align: 'center'},
                {title: 'createBy', field: 'createBy', align: 'center', templet: '#createBy'},
            ]],
            skin: 'line',
            method: 'post',
            defaultToolbar: [{
                title: '刷新',
                layEvent: 'refresh',
                icon: 'layui-icon-refresh',
            }, 'filter', 'print', 'exports']
        });

        form.on('submit(query)', function (data) {
            table.reloadData('table', {
                where: data.field
            })
            return false;
        });


        window.refresh = function (param) {
            table.reloadData('table');
        }
    })
</script>
</body>
</html>
{[{end}]}